import http from '@/api/http.js'
const walletPay = function(orderData) {
	let params = {
		method: 'api/v2/wallet/product_deduction',
		order_sn: orderData.ordersn
	};
	uni.showLoading({
		title:'支付中'
	});
	http(params).then(res => {
		uni.hideLoading();
		if (res.status) {
			let data = res.data;
			uni.showToast({
				title:'支付成功',
				icon: 'none'
			});
			setTimeout(()=>{
				uni.redirectTo({
					url: `/pages/order/paysuccess?ordersn=${data.ordersn}&orderid=${data.id}`
				})
			},1000)
			
		}else{
			uni.showToast({
				title: res.msg,
				icon: 'none'
			});
		}
	});
}

export default walletPay
